﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ThietBiSo.LinQDB;
using ThietBiSo.Models;

namespace ThietBiSo.Controllers
{
    public class gioithieuController : Controller
    {
        //
        // GET: /footer/

        MGioiThieu mgt = new MGioiThieu();
        GioiThieu gt = new GioiThieu();
        public ActionResult Index()
        {
            var v = mgt.FindAll_Web();
            ViewData["gioithieus"] = v;
            return View();
        }    
       
        public ActionResult gioithieu()
        {
            var v = mgt.FindAll();
            ViewData["gioithieus"] = v;
            return View();
        }

        [HttpPost]
        public ActionResult gioithieu(FormCollection collection)
        {
            try
            {

                gt.Id = 1;
                gt.NoiDUng = System.Net.WebUtility.HtmlDecode(collection.Get("ChiTiet"));
                mgt.Update(gt);
                return RedirectToAction("gioithieu");
            }
            catch
            {
                return View();
            }
        }

    }
}
